<?php
namespace My\Controller;
use Utuo\BackgroundController;
class MicroVoteItemController extends BackgroundController
{    private $id;
	public function _initialize(){
		 $this->id=I('micro_vote_id',0,'intval');
		
		$this->setControllerTitle('选项管理');
		$this->setActionTitle(array(
			'index'=>'选项列表',
			'add'=>'选项添加',	
			'modify'=>'选项修改',
			'recycle'=>'回收站',
			
		),null, array (
				'micro_vote_id' =>$this->id 
		));
		$this->setActionNav('index,add,recycle');
	}
	public function getLists($is_deleted){
        $condation=array(
        	
        	'r.cid'=>$this->aid	,
        	'r.micro_vote_id'=>$this->id,
        	'r.is_deleted'=>$is_deleted		
        );
        $m=M('MicroVoteItem r');
        
		$microVoteItem=$m->join('__MICRO_VOTE__ i ON r.micro_vote_id=i.id ')->where($condation)->order('r.id desc')->field("r.*,i.title as microVoteTitle")->select();

		$this->microVoteItem=$microVoteItem;
		$this->display();
	}
	public function addAction(){
		$microVoteItem['micro_vote_id']=$this->id;
		$this->assign("microVoteItem",$microVoteItem)->display('save');
	}

}